﻿using Cinemachine;
using System.Collections.Generic;
using UnityEngine;
using static Cinemachine.CinemachineBlenderSettings;

namespace Fxb.VRB
{
    [RequireComponent(typeof(CinemachineVirtualCameraBase))]
    public class CMOverrideBlendSetting : MonoBehaviour, ICMBlendsSpecified
    {
        [CinemachineBlendDefinitionProperty]
        public CinemachineBlendDefinition Blend
            = new CinemachineBlendDefinition(CinemachineBlendDefinition.Style.EaseInOut, 0.5f);

        public List<string> froms;

        public bool TryGetBlends(ICinemachineCamera from , out CinemachineBlendDefinition blendDefinition)
        {
            blendDefinition = default;

            if (froms?.Count > 0 && !froms.Contains(from.Name))
            {
                return false;
            }

            blendDefinition = Blend;

            return true;
        }
    }
}
